﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Hello DatePicker</title>
    <script src="Scripts/jquery-1.7.js" type="text/javascript"></script>
    <script src="Scripts/jquery-ui-1.8.16.js" type="text/javascript"></script>
    <script type="text/javascript">
        var w = window.screen.width - 50;
        var h = window.screen.height - 100;
        window.moveTo(25, 25);
        window.resizeTo(w, h);
        $(document).ready(function () {
            //分页符
            $('div[id$="Footer"]').css("pageBreakAfter", "always");
            //Stock Name 变红
            $(".StockName").css("color", "red");

            //remove the content div
            //$("div[id$='content']").remove();
            var object = $("#ApplicationLayout");
            $("body").empty();
            $("body").append(object);


            var everyPageCount = $("input[id$='EveryPageCountHiddenField']").val();

            $(".Mdetail").each(function () {
                var dataLines = $("tbody", $(this)).children();
                //此页所含数据的条数，并减去表头。
                var dataLength = dataLines.length - 1;

                var lineHeight = $(dataLines[1]).css("line-height");
                var fontSize = $(dataLines[1]).css("font-size");
                for (var i = 0; i < everyPageCount - dataLength; i++) {
                    var brObject = $("<br/>");
                    brObject.css("line-height", lineHeight);
                    brObject.css("font-size", fontSize);
                    $(".content", $(this).parent().parent().parent()).after(brObject);
                }
            });

            //处理disable的对象的显示，去除其灰色不清晰。
            $('input[id$="tbToBeDeliveredDate"]', $(".ap_info")).datepicker({ disabled: true });
            $("input:disabled", $(".ap_info")).removeAttr("disabled");
            $("select:disabled", $(".ap_info")).removeAttr("disabled");
            $("select", $(".ap_info")).each(function () {
                var object = $('<input type="text" />');
                object.val($(this).val());
                object.addClass("text");
                $(this).replaceWith(object);
            });
            $("input", $(".ap_info")).attr("readOnly", "true");
            $(".image", $(".ap_info")).remove();

            //Remove *
            $("span", $(".ap_info")).filter(function () {
                var content = $(this).html();
                return content.indexOf("*") != -1;
            }).remove();

            window.print();
        });
    </script>
</head>
<body>

    <input id="Text1" type="text" />
</body>
</html>
